<template>
	<view class="container">
		<!-- 	<u-navbar autoBack title="开启青少年模式" :fixed='true' :placeholder="true">
		</u-navbar> -->
		<view class="title">请输入确认密码</view>
		<wakaryInput type="bottom" @finish="handleFinish" />
		<view class="open-model" @click="handleConfirm">确定开启</view>
	</view>
</template>

<script>
	import wakaryInput from './components/wakaryInput/wakaryInput.vue'
	export default {
		components: {
			wakaryInput
		},
		data() {
			return {
				password: ''
			}
		},
		onLoad() {

		},
		methods: {
			handleFinish(val) {
				this.password = val
			},
			handleConfirm() {
				if (this.$isEmpty(this.password)) {
					uni.showToast({
						title: '请输入密码',
						icon: 'none'
					})
					return
				}
				if (getApp().globalData.modelPassword === this.password) {
					uni.setStorageSync('adolescentModelPassword', this.password)
					uni.showToast({
						title: '开启成功',
						duration: 3000
					})
					uni.reLaunch({
						url: '/minePages/adolescentModel/index'
					})
				} else {
					uni.showToast({
						title: '两次密码不一致',
						icon: 'none',
						duration: 3000
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		min-height: 100vh;
		position: fixed;
		top: 0;
		left: 0;
		background-color: #f8f8f8;

		.title {
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
			padding: 10% 0 40rpx 0;
			text-align: center;
		}

		.open-model {
			width: 500rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-radius: 40rpx;
			font-size: 28rpx;
			color: #ffffff;
			background: linear-gradient(180deg, #DB89F5 0%, #834BF4 100%);
			margin: 20% auto 50rpx auto;
		}
	}
</style>